<template>
    <div>
          <ul id="treeDemo" class="ztree"></ul>
    </div>
</template>

<script>
  import '@/assets/plugin/ztreev3/js/jquery.ztree.core'
  import '@/assets/plugin/ztreev3/js/jquery.ztree.excheck'
  export default {
    name: "zTree",
    data:function(){
      return{
        setting:{
          data:{
            simpleData:{
              enable: true,
              idKey: "id",
              pIdKey: "pId",
              rootPId: 0
            }
          }
        },
        zNodes:[
          {id:1, pId:0, name: "图层管理"},
          {id:11, pId:1, name: "矢量图层"},
          {id:12, pId:1, name: "影像图层"}
        ]
      }
    },
    methods:{
      freshArea:function(){
        $.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes);
      }
    },
    mounted(){
      this.$nextTick(function () {
        $.fn.zTree.init($("#treeDemo"), this.setting, this.zNodes);
      });
    }
  }
</script>

<style scoped>
</style>
